* FILE NAME : CASH405.PRG
*
STORE 0 TO CNT,CR
DO WHILE drugk=SPACE(5) .AND. LASTKEY()<>27
   STORE 0 TO CNT,CR
   SELE 9
   SET EXCLU OFF
   use &dr&f9 INDEX &DR&F9
   GO TOP
   SEEK DRUGIN
   do while left(drug_code,1)=drugin
      IF FOR_SALE .and. sale_price>0
         CNT=CNT+1
      ENDIF
      skip
   ENDDO
   IF CNT=0
      RETURN
   ENDIF
   DECLARE FLD[CNT]
   DECLARE KDP[CNT]
   DECLARE LNG[CNT]
   SELE 9
   GO TOP
   SEEK DRUGIN
   do while left(drug_code,1)=drugin
      IF FOR_SALE .and. sale_price>0
         CR=CR+1
         LNG[CR]=LEN(ALLTRIM(DRUG_NAME))+LEN(ALLTRIM(DRUG_TYPE))+LEN(ALLTRIM(DRUG_UNIT))+LEN(ALLTRIM(DRUG_QANT))
         FLD[CR]=DRUG_CODE+' '+ALLTRIM(DRUG_NAME)+' '+ALLTRIM(DRUG_TYPE)+' '+aLLTRIM(DRUG_QANT)+' '+ALLTRIM(DRUG_UNIT)+SPACE(50-LNG[CR])
         KDP[CR]=DRUG_CODE
      ENDIF
      SKIP
   ENDDO
   SET COLOR TO BG+/B
*   @ 9,0 clea to 20,79
   set colo to gr+/rb,gr+/r
   @ 12,28 clea to 20,79
   @ 12,28 to 20,79 double
   pilih=achoice(13,29,19,78,FLD)
   IF LASTKEY()=13
      LNGT=LNG[PILIH]
      FILD=FLD[PILIH]
      DRUGK=KDP[PILIH]
   else
      drugk=space(5)
   ENDIF
endDO
